/* $Header: err_handler.h,v 2.2 01/10/02 10:30:20 przybyls Exp $ */

/***********************************************************************/
/* INCLUDE FILE NAME:  err_handler.h                                   */
/* ==================                                                  */
/*                                                                     */
/* Author:  Lesley Freed                                               */
/*                                                                     */
/* COMMENT:                                                            */
/*                                                                     */
/***********************************************************************/

#ifndef E_HAN_H
#define E_HAN_H

/*****************************/
/*   IFDEFS                  */
/*****************************/


/*****************************/
/*   SYMBOLIC CONSTANTS      */
/*****************************/


/*****************************/
/*   MACROS                  */
/*****************************/

#define RESET_EXCEPTION_DISPLAY()                                              \
{                                                                              \
   INTERRUPTS_OFF                                                              \
      Exception_Display.request = FALSE;                                       \
      Exception_Display.type = (EXCEPTION_TYPE) 0; /* set to lowest priority */ \
   INTERRUPTS_ON                                                               \
}


/*****************************/
/*   TYPEDEFS                */
/*****************************/

typedef struct
{
   BIT8           request;
   EXCEPTION_TYPE type;                     /* Warning, Non Fatal Error, etc. */
   EXCEPTION      exception_no;             /* number for the exception       */
   U_INT16        msg_no;
   INT32          param[2];

} EXCEPTION_DISPLAY;

/*****************************/
/*   EXTERNALS               */
/*****************************/

extern  EXCEPTION_DISPLAY       Exception_Display;

/*****************************/
/*   FUNCTION PROTOTYPES     */
/*****************************/

/* statmon/err_hander.c functions */

#pragma SECTION PROG=SysCode

void    SetException( EXCEPTION flag );
void    ClearException( EXCEPTION flag );

void SetNewException( EXCEPTION flag, INT32 param1, INT32 param2 );
void ClearNewException( EXCEPTION flag );

#pragma SECTION UNDO

void     CheckForExceptionDisplay( void );
BIT8     TestForException ( EXCEPTION flag );
BIT8     ActiveStatusTitle( EXCEPTION flag );
BIT8     ValidExceptionIndex( EXCEPTION type );

void BuildNotReadyEvalMasks( void );
void SetEvalReadyBit( EXCEPTION flag );
BIT8 TestForNotReadyPreRun ( void );
BIT8 TestForNotReady ( void );
BIT8 TestForNotReadyEval ( void );
BIT8 HoldOffTestForNotReadyCore ( void );
BIT8 TestForNotReadyCore ( void );
BIT8 HoldOffTestForNotReadyCoreEval ( void );
BIT8 TestForNotReadyCoreEval ( void );
BIT8 TestForNotReadyDet ( void );
BIT8 TestForNotReadyDetEval ( void );
BIT8 TestForWarning ( void );
BIT8 TestForShutdown ( void );
BIT8 TestForNonFatalErr ( void );
BIT8 TestForMethodWarning ( void );

INT32 GetNotReady ( INT16 word );
INT32 GetNotReadyExt ( void );
INT32 GetMethodWarning ( INT16 word );
INT32 GetWarning ( INT16 word );
INT32 GetShutdown ( INT16 word );
INT32 GetNonFatalErr ( INT16 word );

/* err_init.c functions */

void ClearNotReadyEval ( void );
void ClearGlpWords ( void );
void ClearWarnings ( void );
void ClearMethodWarnings ( void );
void InitializeExceptions ( void );

/* err_conv.c functions */

#pragma SECTION PROG=SysCode
U_INT16 GetStatusMsgNo( EXCEPTION flag );
U_INT16 GetGlpMsgNo( EXCEPTION i, INT32 value_2 );
INT32   GetStatusParam1( EXCEPTION flag );
#pragma SECTION UNDO

U_INT16 GetPopUpMsgNo( EXCEPTION i );
U_INT16 GetGlpSetptMsgNo( SETPT setpt, INT32 value_2 );

#endif
